#include "led.h"
#include "delay.h"
#include "sys.h"
#include "k2os.h"


/**
 *****************************************************************
 *					local defines 
 ***************************************************************** 
 */
#define APP_TASK1_STK_SIZE				(64)
#define APP_TASK2_STK_SIZE				(64)
#define APP_TASK1_PRIORITY				(2)
#define APP_TASK2_PRIORITY				(3)


/**
 *****************************************************************
 *					local global variable 
 ***************************************************************** 
 */
static os_stk_t g_app_task1_stk[APP_TASK1_STK_SIZE];
static os_stk_t g_app_task2_stk[APP_TASK2_STK_SIZE];



static void app_task1(void *arg)
{
	while(1){
	
		led_ctrl(0, 1);
		os_task_dly(200);
		led_ctrl(0, 0);
		os_task_dly(200);
		
	}
}


static void app_task2(void *arg)
{
	while(1){
		led_ctrl(1, 0);
		os_task_dly(200);
		led_ctrl(1, 1);
		os_task_dly(200);
	}
}




 int main(void)
 {	
	os_init();
	LED_Init();

	os_task_create(app_task1, NULL, 
				&g_app_task1_stk[APP_TASK1_STK_SIZE - 1], 
				APP_TASK1_PRIORITY);
	
	os_task_create(app_task2, NULL, 
				&g_app_task2_stk[APP_TASK2_STK_SIZE - 1], 
				APP_TASK2_PRIORITY);

	os_start();
 }

